<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:myta="http://java.sun.com/jsf/composite/myta">

	<ui:composition template="/templates/form.xhtml">
			<ui:define name="title">SIA Online</ui:define>
			<ui:define name="header">Data nilai</ui:define>
			<ui:define name="body">
				<h:form id="nilai" onkeypress="if(event.keyCode==13)return false;">
					<ui:include src="/templates/message.xhtml" />
					<div class="panel panel-primary">
						<div class="panel-heading">Detail nilai</div>
						<div class="panel-body">
							<div class="form-horizontal">
								<myta:inputText id="id" label="ID Nilai" inputBinding="#{nilaiData.txtid}"/>
								
								<div class="form-group">
									<label for="kelassiswa" class="col-sm-2 control-label">Kelas</label>
									<div class="col-sm-10">
										<h:selectOneMenu id="kelassiswa" binding="#{nilaiData.txtidkelassiswa}" styleClass="form-control">
											<f:selectItems value="#{nilaiData.listIdKelasSiswa}"/>
											<f:ajax event="change" listener="#{nilaiData.loadDataSiswa()}" execute="kelassiswa" render="datatable"/>
										</h:selectOneMenu>
									</div>
								</div>
								
								<div class="form-group">
									<label for="mapel" class="col-sm-2 control-label">Mata Pelajaran</label>
									<div class="col-sm-10">
										<h:selectOneMenu id="mapel" binding="#{nilaiData.txtidmapel}" styleClass="form-control">
											<f:selectItems value="#{nilaiData.listIdMapel}"/>
											<f:ajax event="change" listener="#{nilaiData.loadNamaGuru()}" execute="mapel" render="nama:nama"/>
										</h:selectOneMenu>
									</div>
								</div>
								
								<myta:inputText id="nama" label="Guru" inputBinding="#{nilaiData.txtnamaguru}"/>
								
								<div class="form-group">
									<label for="jenisnilai" class="col-sm-2 control-label">Jenis Nilai</label>
									<div class="col-sm-10">
										<h:selectOneMenu id="jenisnilai" binding="#{nilaiData.txtidjenisnilai}" styleClass="form-control">
											<f:selectItems value="#{nilaiData.listIdJenisNilai}"/>
										</h:selectOneMenu>
									</div>
								</div>
							</div>
						</div>
					</div>
					
					<div class="panel panel-primary">
						<div class="panel-heading">Detail Data Absensi</div>
						<div class="panel-body">
							<h:dataTable id="datatable" value="#{dataDetail.dataNilai.dataRows}" var="var" styleClass="table table-bordered table-striped datatable">
								<h:column>
									<f:facet name="header">NIS</f:facet>
									#{var[1]}
								</h:column>
								<h:column>
									<f:facet name="header">Nama</f:facet>
									#{var[2]}
								</h:column>
								<h:column>
									<f:facet name="header">Nilai</f:facet>
									<h:inputText value="#{var[3]}" style="text-align:center;"/>
								</h:column>
							</h:dataTable>
						</div>
					</div>
					
					<div class="pull-right">
						<h:commandButton value="Simpan" action="#{nilaiData.save}" styleClass="btn btn-success">
						</h:commandButton>&nbsp;
						<h:commandButton value="Batal" action="#{nilaiData.cancel}" styleClass="btn btn-info">
						</h:commandButton>
					</div>
				</h:form>
			</ui:define>
	</ui:composition>
</html>